| Conditions | 1 |
| Paths | 8 |
| Total Lines | 32 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | (function( $ ){ |
||
| 3 | $.fn.filemanager = function(type, options) { |
||
| 4 | type = type || 'file'; |
||
| 5 | |||
| 6 | this.on('click', function(e) { |
||
|
|
|||
| 7 | var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager'; |
||
| 8 | var target_input = $('#' + $(this).data('input')); |
||
| 9 | var target_preview = $('#' + $(this).data('preview')); |
||
| 10 | window.open(route_prefix + '?type=' + type, 'FileManager', 'width=900,height=600'); |
||
| 11 | window.SetUrl = function (items) { |
||
| 12 | var file_path = items.map(function (item) { |
||
| 13 | return item.url; |
||
| 14 | }).join(','); |
||
| 15 | |||
| 16 | // set the value of the desired input to image url |
||
| 17 | target_input.val('').val(file_path).trigger('change'); |
||
| 18 | |||
| 19 | // clear previous preview |
||
| 20 | target_preview.html(''); |
||
| 21 | |||
| 22 | // set or change the preview image src |
||
| 23 | items.forEach(function (item) { |
||
| 24 | target_preview.append( |
||
| 25 | $('<img>').css('height', '5rem').attr('src', item.thumb_url) |
||
| 26 | ); |
||
| 27 | }); |
||
| 28 | |||
| 29 | // trigger change event |
||
| 30 | target_preview.trigger('change'); |
||
| 31 | }; |
||
| 32 | return false; |
||
| 33 | }); |
||
| 34 | } |
||
| 35 | |||
| 37 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.